<?php
echo $currentObject->remarque;

   
echo "</br>";




$SQL="SELECT
Count(cabinet_soin_images.image) as count
FROM
cabinet_soins
INNER JOIN cabinet_soin_images ON cabinet_soin_images.soinId = cabinet_soins.id
WHERE
cabinet_soins.id = $currentObject->id ";

$rs=ew_LoadRecordset($SQL);
if ($rs && !$rs->EOF) $count=$rs->fields['count'];

if ($count > 0 ){
?>
<a onclick="javascript:ajoutdossierimages(<?=$currentObject->id  ?>,<?=getParameter("dossierId")  ?>)"  class="myButtonImage">   Images</a>		
<?php  }?>		
		
<?php		
$SQL="SELECT
Count(cabinet_soin_radios.image) as count
FROM
cabinet_soins
INNER JOIN cabinet_soin_radios ON cabinet_soins.id = cabinet_soin_radios.soinId
WHERE
cabinet_soins.id = $currentObject->id ";

$rs=ew_LoadRecordset($SQL);
if ($rs && !$rs->EOF) $count=$rs->fields['count'];

if ($count > 0 ){
?>
<a onclick="javascript:ajoutdossierradios(<?=$currentObject->id  ?>)"  class="myButtonRadio"> Radio</a>
<?php  }?>		
		
		
<?php		
$SQL="SELECT
Count(cabinet_ordonnance_medicament.id) AS count
FROM
cabinet_soins
INNER JOIN cabinet_ordonnance_medicament ON cabinet_ordonnance_medicament.soinId = cabinet_soins.id
WHERE
cabinet_soins.id = $currentObject->id ";

$rs=ew_LoadRecordset($SQL);
if ($rs && !$rs->EOF) $count=$rs->fields['count'];

if ($count > 0 ){
?>
<a onclick="javascript:ajoutordonnance(<?=$currentObject->id  ?>)"  class="myButtonOrdonnance">Ordonnance</a>
<?php  }?>			
		



		
<?php		
$SQL="SELECT
Count(cabinet_certificat.id) AS count
FROM
cabinet_certificat
INNER JOIN cabinet_soins ON cabinet_soins.id = cabinet_certificat.soinId
WHERE
cabinet_soins.id = $currentObject->id ";

$rs=ew_LoadRecordset($SQL);
if ($rs && !$rs->EOF) $count=$rs->fields['count'];

if ($count > 0 ){
?>
<a onclick="javascript:ajoutcertificat(<?=$currentObject->id  ?>)"  class="myButtonCertificat">Certificat</a>
<?php  }?>	

		
<?php		
$SQL="SELECT
Count(cabinet_devis.id) AS count
FROM
cabinet_soins
INNER JOIN cabinet_devis ON cabinet_devis.soinId = cabinet_soins.id
WHERE
cabinet_soins.id = $currentObject->id ";

$rs=ew_LoadRecordset($SQL);
if ($rs && !$rs->EOF) $count=$rs->fields['count'];

if ($count > 0 ){
?>
<a onclick="javascript:ajoutdevis(<?=$currentObject->id  ?>)"  class="myButtonDevis">Devis</a>
<?php  }?>	
		
		
	<script>
		
function ajoutdossierimages(id,dossierId){
	var iframe = $('#ifrsoins');
    

	
	url="/butterflyportal/iframe.php?table=cabinet_soin_images&filter=soinId="+id;

$("#cabinet_soin_images_iframe").attr('src',url); 


			$("#cabinet_soin_images_iframe_div").dialog({
				autoOpen: true,
				height: 500,
				width: 1000,
				modal: true,
				zIndex: 3999,
				buttons: {
					
					Close: function() {
						window.location = "/butterflyportal/iframe.php?table=cabinet_soins&filter=dossierId="+$dossierId+"&masterkey="+$dossierId;
						$( this ).dialog( "close" );
					}
				}


				});


	
}


function ajoutdossierradios(id){
	var iframe = $('#ifrsoins');
   

	
	url="/butterflyportal/iframe.php?table=cabinet_soin_radios&filter=soinId="+id;

$("#cabinet_soin_radios_iframe").attr('src',url); 


			$("#cabinet_soin_radios_iframe_div").dialog({
				autoOpen: true,
				height: 500,
				width: 1000,
				modal: true,
				zIndex: 3999,
				buttons: {
					
					Close: function() {
						$( this ).dialog( "close" );
					}
				}


				});


	
}


function ajoutordonnance(id){
	var iframe = $('#ifrsoins');
	url="/butterflyportal/iframe.php?table=cabinet_ordonnance_medicament&filter=soinId="+id;
	$("#cabinet_ordonnance_medicament_iframe").attr('src',url); 
			$("#cabinet_ordonnance_medicament_iframe_div").dialog({
				autoOpen: true,
				height: 500,
				width: 1000,
				modal: true,
				zIndex: 3999,
				buttons: {
						Close: function() {
						$( this ).dialog( "close" );
					}
				}
				});	
}

function ajoutcertificat(id){
	var iframe = $('#ifrsoins');
    
		  
	url="/butterflyportal/iframe.php?table=cabinet_certificat&filter=soinId="+id;
	$("#cabinet_certificat_iframe").attr('src',url); 
			$("#cabinet_certificat_iframe_div").dialog({
				autoOpen: true,
				height: 500,
				width: 1000,
				modal: true,
				zIndex: 3999,
				buttons: {
					
					Close: function() {
						$( this ).dialog( "close" );
					}
				}


				});	
}


function ajoutdevis(id){
	var iframe = $('#ifrsoins');
   
	url="/butterflyportal/iframe.php?table=cabinet_devis&filter=soinId="+id;
	$("#cabinet_devis_iframe").attr('src',url); 
			$("#cabinet_devis_iframe_div").dialog({
				autoOpen: true,
				height: 500,
				width: 1000,
				modal: true,
				zIndex: 3999,
				buttons: {
					
					Close: function() {
						$( this ).dialog( "close" );
					}
				}


				});	
}
</script>	



<div id="cabinet_soin_images_iframe_div" title="Ajout d'images de soins"  style="display: none" class="portal_iframe" >
<iframe frameborder="0" id="cabinet_soin_images_iframe" src="" width="100%" style="border-width: 0px;" height="100%"></iframe>

</div>	



<div id="cabinet_soin_radios_iframe_div" title="Ajout des radios de soins"  style="display: none" class="portal_iframe" >
<iframe frameborder="0" id="cabinet_soin_radios_iframe" src="" width="100%" style="border-width: 0px;" height="100%"></iframe>

</div>



	<div id="cabinet_ordonnance_medicament_iframe_div" title="Générer une ordonnance"  style="display: none" class="portal_iframe" >
<iframe frameborder="0" id="cabinet_ordonnance_medicament_iframe" src="" width="100%" style="border-width: 0px;" height="100%"></iframe>

</div>	


<div id="cabinet_devis_iframe_div" title="Générer un devis"  style="display: none" class="portal_iframe" >

<iframe frameborder="0" id="cabinet_devis_iframe" src="" width="100%" style="border-width: 0px;" height="100%"></iframe>

</div>	